import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询规则列表
export function listRule(query) {
  return request({
    url: '/rule/monitor/list',
    method: 'get',
    params: query
  })
}

// 查询规则详细
export function getRule(ruleId) {
  return request({
    url: '/rule/monitor/' + parseStrEmpty(ruleId),
    method: 'get'
  })
}

// 添加规则
export function addRule(data) {
  return request({
    url: '/rule/monitor',
    method: 'post',
    data: data
  })
}

// 修改规则
export function updateRule(data) {
  return request({
    url: '/rule/monitor',
    method: 'put',
    data: data
  })
}

// 删除规则
export function delRule(ruleId) {
  return request({
    url: '/rule/monitor/' + ruleId,
    method: 'delete'
  })
}

export function changeUserStatus(ruleId, status) {
  const data = {
    ruleId,
    status
  }
  return request({
    url: '/rule/monitor/changeStatus',
    method: 'post',
    data: data
  })
}
